package joc.internal.transformer;

import javassist.CtClass;
import javassist.CtMethod;
import joc.contract.Pure;
import joc.internal.transformer.helper.PureExpressionEditor;

public class PureMethodTransformer extends DeclaredMethodTransformer {

	public PureMethodTransformer(Transformer transformer) {
		super(transformer);
	}

	@Override
	public void transform(CtClass clazz, CtMethod method) throws Exception {
		getLogger().debug("method " + method.getLongName());
		if (hasInheritedAnnotation(method, Pure.class)) {
			method.instrument(new PureExpressionEditor(this, false));
		}
	}
}
